package com.whenjun.thread;

import com.whenjun.common.LoggerParent;
import com.whenjun.entity.Request;
import com.whenjun.service.IRequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @Auther: whenjun
 * @Date: 2023/6/5 0005 17:48
 * @Description:
 */
@Service
public class AsyncServiceResponse extends LoggerParent {

    @Autowired
    private IRequestService requestService;

    @Async("asyncServiceExecutor")
    public void updateRespBodyByPrimaryKey(String requestId, String respBody){
        Request request = new Request();
        request.setId(requestId);
        request.setResponseBody(respBody);
        requestService.updateById(request);
    }
}
